package com.niit.dao.impl;

import java.util.List;

import com.niit.bean.BlogReply;
import com.niit.dao.BlogReplyDao;
import com.niit.utils.DbUtil;

public class BlogReplyDaoImpl implements BlogReplyDao {

	private DbUtil util=new DbUtil();
	@Override
	public int add(BlogReply t) { 
		String sql = "insert into tb_blog_reply(blog_id,replier,content) values(?,?,?) ";
		int a=util.update(sql, t.getBlogId(),t.getReplier(),t.getContent());
		return a;
	}

	@Override
	public int delete(BlogReply t) {
		String sql = "delete from tb_blog_reply where id=? ";
		int a=util.update(sql, t.getId());
		return a;
	}

	@Override
	public int update(BlogReply t) {
		return 0;
	}

	@Override
	public List<BlogReply> findAll(int start, int end) {
		String sql = "select * from (select rownum r,tb_blog_reply.* from tb_blog_reply) a where a.r>? and a.r<=? ";
		List<BlogReply> list = util.select(sql,BlogReply.class, start,end);
		return list;
	}

	@Override
	public int findTotal() {
		String sql="select count(*) from tb_blog_reply ";
		int count=util.selectCount(sql);
		return count;
	}

}
